<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>window对象</title>
    <script>
        function f1(){
            window.open();
        }
        function f2(){
            // 打开指定窗口
            open("35-事件冒泡.html");
        }
        function f3(){
            // 可以通过open方法的第三个参数指定窗口参数
            open("35-事件冒泡.html","aa","width=300px,height=300px");
        }
        function f4(){
            // 周期性执行,每隔指定time毫秒后执行一次fn函数
            // window.setInterval(fn,time)
            setInterval(function(){
                open("35-事件冒泡.html","aa","width=300px,height=300px");
            },200)
        }
        function f5(){
            // open方法的返回值表示的是当前打开的窗口对象
            let win = open("35-事件冒泡.html","aa","width=300px,height=300px");
            win.close();
        }
        function f6(){
            let win = open("35-事件冒泡.html","aa","width=300px,height=300px");
            // 延时执行函数,延迟time毫秒后执行指定函数fn
            // setTimeout(fn,time)
            setTimeout(function(){
                win.close();
            },3000)
        }
        function f7(){
            let i = setInterval(function(){
                open("35-事件冒泡.html","aa","width=300px,height=300px");
            },200)
            setTimeout(function(){
                // 取消周期性函数
                clearInterval(i);
            },3000)
        }

        function f8(){
            let win = open("35-事件冒泡.html","aa","width=300px,height=300px");
            let t = setTimeout(function(){
                win.close();
            },3000)
            clearTimeout(t);
        }
    </script>
</head>
<body>
<button onclick="f1()">打开新窗口</button>
<button onclick="f2()">打开指定窗口</button>
<button onclick="f3()">打开小窗口</button>
<button onclick="f4()">无限打开小窗口</button>
<button onclick="f5()">关闭打开的窗口</button>
<button onclick="f6()">打开小窗口3秒自动关闭</button>
<button onclick="f7()">无限打开小窗口,3秒停止弹窗</button>
<button onclick="f8()">取消延迟函数</button>
</body>
</html>